#include<iostream>
using namespace std;
const int N = 1e4 + 10;
int arr[N];
int n, m;
int main()
{
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int x;
		cin >> x;
		arr[x]++;
	}
	int mi = 1e5;
	for (int i = 1; i <= n; i++) {
		if (arr[i] < mi) {
			mi = arr[i];
		}
	}
	cout << mi << endl;
	return 0;
}